﻿using Hotel.DAL;
using Hotel.Model.Shop;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Hotel.BLL
{
    public class ShopBLL
    {
        public ShopBLL(ShopDAL shopDAL) 
        {
            ShopDAL = shopDAL;
        }

        public ShopDAL ShopDAL { get; }








        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="shopModel"></param>
        /// <returns></returns>
        public int ShopAdd(ShopModel shopModel)
        {
           
            return ShopDAL.ShopAdd(shopModel);

        }




        /// <summary>
        ///显示
        /// </summary>
        /// <param name="count"></param>
        /// <param name="page"></param>
        /// <param name="ShopName">门店名称</param>
        /// <param name="ShopType">服务范围</param>
        /// <param name="index"></param>
        /// <param name="size"></param>
        /// <returns></returns>

        public List<ShopModel> ShopList(out int count, out int page, string? ShopName="", string? ShopType = "-1", int index = 1, int size = 2)
        {

            return ShopDAL.ShopList(out count, out page, ShopName, ShopType, index, size);

        }





        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int ShopDel(int id)
        {

          
            return ShopDAL.ShopDel(id);
        }






        /// <summary>
        /// 反填
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ShopModel ShopAll(int id)
        {
            return ShopDAL.ShopAll(id);

        }



        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="shopModel"></param>
        /// <returns></returns>
        public int ShopUpd(ShopModel shopModel)
        {

            return ShopDAL.ShopUpd(shopModel);
        }




        /// <summary>
        /// 修改状态
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="State"></param>
        /// <returns></returns>
        public int UpdState(string ids, int State)
        {
            var  res= ShopDAL.UpdState(ids, State);
            if (res>0)
            {
                return 1;//成功
            }
            else
            {
                return 2;//失败 
            } 

        }


















    }
}
